<!DOCTYPE html>
<html>

	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>扫码取纸</title>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/vue.min.js"></script>
		<style>
			html,
			body {
				background-color: transparent !important;
			}
			*{
				padding: 0;
				margin: 0;
			}

			.mui-bar-nav {
				background: #fff;
				box-shadow: none;
			}

			.mui-icon-left-nav {
				color: #60C68B;
			}

			.container_box {
				position: relative;
				height: 100%;
				padding-top: 40px;
			}
			#bcid {
				position: absolute;
				background:transparent;
				height:480px;
				width:100%;
				margin: 0 auto;
			}
			#text{
				border: none;
			}	
		</style>
	</head>

	<body>
		<div id="app" class="takepaper">
			<header id="header" class="mui-bar mui-bar-nav">
				<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
				<h1 class="mui-title">扫码取纸</h1>
			</header>
			<div class="container_box">
				<div id="bcid"></div>
				<input type='text' id='text' />
			</div>
		</div>
		<script src="../../js/vue-resource.js"></script>
		<script src="../../js/base.js"></script>
		<script>
			mui.plusReady(function() {
				var current_window = plus.webview.currentWebview();
				//获取手机的高度:plus.display.resolutionHeight;
				var bodyHeight = plus.display.resolutionHeight;
				var res_hight = bodyHeight - 40;
				//实际的高度 把扫码区域全屏
				var o = document.getElementById("bcid");
				o.style.height = res_hight + "px";


				var vm = new Vue({
					el: '#app',
					data: {
						result:""
					},
					methods: {
						startRecognize() { //一上来创建二维码框框
							var scan = null;
							var _this=this;
							function onmarked(type, result) {
								var text = '未知: ';
								switch (type) {
									case plus.barcode.QR:
										text = 'QR: ';
										break;
									case plus.barcode.EAN13:
										text = 'EAN13: ';
										break;
									case plus.barcode.EAN8:
										text = 'EAN8: ';
										break;
								}
								// alert(text + result);
								console.log(JSON.stringify(result));
								_this.result=result;
								
								BASE.Custom_window('taker_info.html', 'taker_info', {url:_this.result});
								
								
							}

							scan = new plus.barcode.Barcode('bcid');
							scan.onmarked = onmarked;
							scan.start();
						},
						Open_weixin() {//用来打开微信 第三方程序   plus.runtime.launchApplication   参数pname  是包名的意思;  com.tencent.mm 是微信包名
							
								if (plus.os.name == "Android") {
									plus.runtime.launchApplication({
										pname: "com.tencent.mm"
									}, function(e) {
										plus.nativeUI.confirm("检查到您未安装\"微信\"，是否到商城搜索下载？", function(i) {
											if (i.index == 0) {
												androidMarket("com.tencent.mm");
											}
										});
									});
								} else if (plus.os.name == "iOS") {
									plus.runtime.launchApplication({
										action: "weixin://RnUbAwvEilb1rU9g9yBU"
									}, function(e) {
										plus.nativeUI.confirm("检查到您未安装\"微信\"，是否到商城搜索下载？", function(i) {
											if (i.index == 0) {
												iosAppstore("itunes.apple.com/cn/app/wechat/id414478124?mt=8");
											}
										});
									});
								}
								// plus.runtime.openURL(vm.result);

								 // var url = "http://weixin.qq.com/r/RnUbAwvEilb1rU9g9yBU";  
								 // plus.runtime.openURL(vm.result);  
							
						}
					},
					created() {
						this.startRecognize();


					},
					watch: {


					}
				})
			})
		</script>
	</body>

</html>
